public class demo04 {
    //三连击
    public static void main(String[] args) {
        int[] arr={1,2,3,4,5,6,7,8,9};
        dfs(arr,0);
    }
    public static void dfs(int[] arr,int k){
        if(k==arr.length){
            check(arr);
        }
        for (int i = k; i < arr.length; i++) {
            swap(arr,k,i);
            dfs(arr,k+1);
            swap(arr,k,i);
        }
    }
    public static void check(int[] num){
        int a=num[0]*100+num[1]*10+num[2];
        int b=num[3]*100+num[4]*10+num[5];
        int c=num[6]*100+num[7]*10+num[8];
        if(a*2==b&&a*3==c){
            System.out.println(a+" "+b+" "+c);
        }
    }
    public static void swap(int[] arr,int i,int j){
        int tmp=arr[i];
        arr[i]=arr[j];
        arr[j]=tmp;
    }
}
